const Mock = require('mockjs');
const Moment = require('moment');

Moment.locale('zh-cn');
let uploadTime = Moment().format('LL h:mm');
let fromNow = Moment().fromNow();

const getClassData = function() {
  const data = Mock.mock({
    'classData|10': [
      {
        'key|+1': 1,
        'machineNumber|+1': 1,
        fromNow: fromNow,
        uploadTime: uploadTime,
        'light|1-10.2': 0.1,
        'temperature|1-10.2': 0.1,
        'humidity|1-10.2': 0.1,
        'smoke|1-10.2': 0.1
      }
    ]
  });
  return data;
};

exports.getClassData = getClassData;

// 单元测试
// const result = getClassData();
// console.log(result);
